﻿// *************************************************************************************************
// Project: RealSense.Light.Core
// Namespace: RealSense.Light.Core.Configuration
// File: EmotionDetectionConfiguration.cs  Author: Peter O'Hanlon
// Copyright © Peter O'Hanlon 2014-2015
// Date: 2015/1/2 13:46
// *************************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RealSense.Light.Core.Configuration
{
  /// <summary>
  /// Custom configuration for controlling the way that emotion detection works with RealSense.
  /// </summary>
  public class EmotionDetectionConfiguration : ConfigurationBase
  {
    /// <summary>
    /// Set the threshold to use to determine that an emotion will be used.
    /// </summary>
    /// <param name="intensity">The intensity - a value between 0 and 1.</param>
    /// <returns>The current instance.</returns>
    public EmotionDetectionConfiguration SetEmotionalIntensity(float intensity)
    {
      if (intensity < 0)
      {
        throw new ArgumentOutOfRangeException("intensity", "The intensity must be greater than 0.");
      }
      if (intensity > 1)
      {
        throw new ArgumentOutOfRangeException("intensity", "The intensity must be less than or equal to 1.");
      }

      EmotionalIntensity = intensity;
      return this;
    }

    /// <summary>
    /// Gets the emotional intensity to determint that an emotion will be used.
    /// </summary>
    public float EmotionalIntensity { get; private set; }

    protected override void GetDefaultConfiguration()
    {
      EmotionalIntensity = 0.5f;
    }
  }
}